package com.TestDemo.Test1;

public class ClassLoaderTest {
    public static void main(String[] args) throws ClassNotFoundException {
        Class<?> string = Class.forName("com.TestDemo.Test1.ClassTest");

        string.getClassLoader();
        System.out.println(string.getClassLoader());  // sun.misc.Launcher$AppClassLoader@18b4aac2
        System.out.println(string.getClassLoader().getParent()); // sun.misc.Launcher$ExtClassLoader@45ee12a7
        System.out.println(string.getClassLoader().getParent().getParent()); // null
        try {
            System.out.println(string.getClassLoader().getParent().getParent().getParent());
        } catch (Exception e) {

        }finally {
            Class sss = String.class;
            System.out.println("---------------------------------");
            System.out.println(sss.getName());
            System.out.println(sss.getClassLoader());
            System.out.println(sss.getClassLoader().getParent());
            System.out.println(sss.getClassLoader().getParent().getParent());
        }





    }
}
